import request from '../utils/request'
import config from '../utils/config'
console.log('config.BaseUrl:', config.BaseUrl )
// 登录
export function login(data) {
  const urlStr = '/user/loginByEmail'
  const url = process.env.NODE_ENV === 'production' ? config.BaseUrl + urlStr : urlStr;
  return request({
    url,
    method: 'post',
    data: data
  })
}

// 注册
export function registe(data) {
  const urlStr = '/user/registerByEmail'
  const url = process.env.NODE_ENV === 'production' ? config.BaseUrl + urlStr : urlStr;
  return request({
    url,
    method: 'post',
    data: data
  })
}

// 手机验证码
export function sendSmsForLogin(data) {
  const urlStr = '/user/sendSmsForLogin'
  const url = process.env.NODE_ENV === 'production' ? config.BaseUrl + urlStr : urlStr;
  return request({
    url,
    method: 'post',
    data: data
  })
}

// 手机验证码登录
export function loginBySmsCode(data) {
  const urlStr = '/user/loginBySmsCode'
  const url = process.env.NODE_ENV === 'production' ? config.BaseUrl + urlStr : urlStr;
  return request({
    url,
    method: 'post',
    data: data
  })
}
